<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>函数类型</title>
    <script>
        // function sum(a,b,c){
        //     console.log(a+b+c);
        //     console.log(arguments);
        // }
        function sum() {
            let a = arguments[0];
            let b = arguments[1];
            let c = arguments[2];
            console.log(a + b + c);
            for (let i = 0; i < arguments.length; i++) {
                console.log(arguments[i])
            }
        }

        function f1() {
            let f = fn;
            console.log(typeof f);
        }

        function fn() {
            console.log("这是fn函数")
        }

        function f2() {
            let f = function () {
                console.log("这是匿名函数")
            }
            console.log(typeof f);
        }

        function f3() {
            // ES6引入了Lambda表达式用法
            let a = function () {
                return "Hello Lambda";
            }
            let a2 = () => "Hello Lambda";
            console.log(typeof a2);
            // 将函数a2的返回值赋值给变量s,此时的变量s是一个字符串
            let s = a2();
            console.log(s);

            let b = function () {
                console.log("xxxx")
            }
            let b2 = () => console.log("Hello Lambda");

            let c = function () {
                console.log("admin")
                return "admin";
            }
            let c2 = () => {
                console.log("admin")
                return "admin";
            }
            let s2 = c2();
            console.log(s2);

        }
    </script>
</head>
<body>
<button onclick="sum(1,2,3,4,5)">求和</button>
<br>
<button onclick="f1()">函数定义方式一</button>
<br>
<button onclick="f2()">函数定义方式二</button>
<br>
<button onclick="f3()">函数定义方式三</button>
<br>
</body>
</html>